<!---->
<template>
    <div class="common_footer" style="position: inherit;">
        <tabbar @on-index-change="checkItem">
            <tabbar-item :selected="checkIndex === 0">
                <img slot="icon" v-if="checkIndex === 0" src="../../static/images/icon-file-check.png"/>
                <img slot="icon" v-else src="../../static/images/icon-file.png"/>
                <span slot="label">居民信息</span>
            </tabbar-item>
            <tabbar-item :selected="checkIndex === 1">
                <img slot="icon" v-if="checkIndex === 1" src="../../static/images/icon-company-check.png">
                <img slot="icon" v-else src="../../static/images/icon-company.png">
                <span slot="label">企业信息</span>
            </tabbar-item>
            <tabbar-item :selected="checkIndex === 2">
                <img slot="icon" v-if="checkIndex === 2" src="../../static/images/icon-user.png">
                <img slot="icon" v-else src="../../static/images/icon-user-check.png">
                <span slot="label">个人中心</span>
            </tabbar-item>
        </tabbar>
    </div>
</template>

<script>
    import {Tabbar, TabbarItem} from 'vux'

    export default {
        name: "",
        components: {
            Tabbar,
            TabbarItem,
        },
        data() {
            return {
                checkIndex: Number(window.sessionStorage.getItem('checkIndex'))
            }
        },

        methods: {
            checkItem(index) {
                this.checkIndex = index;
                window.sessionStorage.setItem('checkIndex', index)
                if (index === 0) {
                    this.$tools.goPage('home')
                } else if (index === 1) {
                    setTimeout(()=>{
                        this.$tools.goPage('companyInfo')
                    },10)
                } else {
                    this.$tools.goPage('userInfo')
                }
            }
        },
    };
</script>

<style lang="less" rel="stylesheet/less" type="text/less">
    .weui-tabbar__item.weui-bar__item_on .weui-tabbar__icon, .weui-tabbar__item.weui-bar__item_on .weui-tabbar__icon
    > i, .weui-tabbar__item.weui-bar__item_on .weui-tabbar__label {
        color: #6c84e5 !important
    }
</style>
